1. Field of the Invention
The present invention relates to an electronic apparatus which includes in its main body a first-axis magnetic sensor for outputting a value corresponding to a component of an external magnetic field along the direction of a first axis and a second-axis magnetic sensor for outputting a value corresponding to a component of the external magnetic field along the direction of a second axis intersecting the first axis at a predetermined angle and which can detect the azimuth of a third axis of the main body and/or the inclination angle of the third axis on the basis of the values output from these magnetic sensors.
2. Description of the Related Art
Recently, incorporation of a magnetic sensor into an electronic apparatus such as a cellular phone has been considered, with an aim toward detecting the direction of the local geomagnetic field by use of the magnetic sensor, to thereby impart an azimuth detection function to the electronic apparatus. In such a case, since such a magnetic sensor is desired to be small, there may be employed a two-direction detection type magnetic sensor (an X-Y axis terrestrial magnetism sensor) which includes an X-axis magnetic sensor serving as a first-axis magnetic sensor for detecting a magnetic field component along the direction of a transverse axis of the main body and a Y-axis magnetic sensor serving as a second-axis magnetic sensor for detecting a magnetic field component along the direction of a longitudinal axis of the main body perpendicular to the transverse axis.
Incidentally, the direction of the local geomagnetic field forms a predetermined angle with respect to a horizontal plane, whereas the inclination of the local geomagnetic field varies from location to location. Further, in many cases, an electronic apparatus such as a cellular phone is used in a state in which the longitudinal axis of the main body inclines by a predetermined inclination angle with respect to the horizontal plane. Therefore, the angle between the local geomagnetic field and the longitudinal axis of the electronic apparatus changes depending on the location where the electronic apparatus is used and the inclination angle of the electronic apparatus during use, even if the azimuth of the longitudinal axis is maintained constant. Since output of the Y-axis magnetic sensor changes due to influences of not only azimuth but other factors (i.e., inclination of the geomagnetic field and inclination of the longitudinal axis), azimuth may be erroneously detected when the electronic apparatus is configured so as to recognize output of the X-axis magnetic sensor and output of the Y-axis magnetic sensor as detection values of the local geomagnetic field and determine the azimuth of the longitudinal axis on the basis of the detection values only, on the assumption that the inclination angle is constant.